﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace SlamCms.SharePoint.Migration
{
	public class MigratableFieldLink : IMigratable
	{
		public string Title { get; set; }
		public string StaticName { get; set; }
		public string SourceSite { get; set; }
		public string SourceList { get; set; }

		#region Serialization

		public XElement ToXml()
		{
			XElement node = new XElement("FieldLink");
			node.Add(new XAttribute("Title", Title));
			node.Add(new XAttribute("StaticName", StaticName));
			node.Add(new XAttribute("SourceSite", SourceSite));
			node.Add(new XAttribute("SourceList", SourceList));
			return node;
		}

		public void FromXml(XElement element)
		{
			this.Title = element.Attribute("Title").Value;
			this.StaticName = element.Attribute("StaticName").Value;
			this.SourceSite = element.Attribute("SourceSite").Value;
			this.SourceList = element.Attribute("SourceList").Value;
		}

		#endregion
	}
}
